package org.shilong.MLogic.Json.party;

import java.util.LinkedList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.shilong.Model.PartyModel;

public class GetMyParies4JsonLogic {


	private static JSONObject jObject = null;

	private static JSONArray jArr = null;


	private static LinkedList<PartyModel> mList = null;


	public static LinkedList<PartyModel> getRlt( Object req ){

		jObject = null;

		mList = null;

		jArr = null;


		mList = new LinkedList<PartyModel>();
		try {
			jObject = new JSONObject( (String)req );

			jArr = jObject.getJSONArray( "rlt" );

			for( int i = 0; i < jArr.length(); i++ ){
				
				/*obj.put("pa_id", partyModel.getPa_seq_id() + "");
				obj.put("type", partyModel.getPa_type());
				obj.put("pa_comment", partyModel.getPa_comment());
				obj.put("pa_end_time", partyModel.getPa_end_time());
				obj.put("pa_start_time", partyModel.getPa_start_time());
				obj.put("pa_title", partyModel.getPa_title());*/
				
				JSONObject oo = jArr.getJSONObject( i );

				PartyModel bean = new PartyModel();
				
				bean.setPa_seq_id( oo.getString( "pa_id" ) );
				bean.setPa_type( oo.getString("type") );
				bean.setPa_comment( oo.getString( "pa_comment" ));
				bean.setEnd_time( oo.getString( "pa_end_time" ));
				bean.setPa_start_time( oo.getString( "pa_start_time" ));
				bean.setPa_title( oo.getString( "pa_title" ));

				mList.add(bean);
			}
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		System.out.println( "mList.size():" + mList.size() );
		return mList;
	}
	
}
